home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-01 / lspd05_1.zip / LSPEED.H < prev    next >
C/C++ Source or Header  |  1991-10-21  |  13KB  |  286 lines

  1. /*
  2. ┌───────────────────────────────────────────────────────────────────────────┐
  3. │                                                                           │
  4. │       L I G H T - S P E E D   P R O G R A M M E R S   L I B R A R Y       │
  5. │                                                                           │
  6. │           S U P E R   F A S T   G R A P H I C S   T O O L K I T           │
  7. │                                                                           │
  8. │                                                                           │
  9. │         SOURCE CODE MODULE, COPYRIGHT (C) 1991, ALL RIGHTS RESERVED       │
  10. │                                                                           │
  11. │                   DESIGNED AND PROGRAMMED BY DARREN LYON                  │
  12. │                                                                           │
  13. │             ▄▄  ▄▄  ▄▄  ▄▄▄▄  ▄▄▄▄▄  ▄▄  ▄   ▄   ▄   ▄▄▄  ▄▄▄▄ tm         │
  14. │             ██  ▀█▄▄█▀ ██  ▄▄ ▄▄ ▀██  █▄ █▄ ▄█   ▀█    ██ ▄▄▄             │
  15. │             ▀▀    ▀▀   ██  ██ ██  ██   █▄ █▄█ ▄█▀ ▀█ ▀▀█▄ █               │
  16. │             ▀▀▀▀▀ ▀▀    ▀▀▀▀  ▀▀  ▀▀    ▀  ▀  ▀▀▀▀▀▀    ▀ ▀▀▀▀            │
  17. │                                                                           │
  18. └───────────────────────────────────────────────────────────────────────────┘*/
  19.  
  20. /***
  21.  ***   LIGHT SPEED GRAPHICS LIBRARY
  22.  ***   FUNCTION INTERFACE HEADER FILE
  23.  ***/
  24.  
  25. /* Test for previous inclusion, abort if so */
  26. #ifndef LIGHT_SPEED_GRAPHICS
  27.  
  28. /* Define our own flag */
  29. #define LIGHT_SPEED_GRAPHICS
  30.  
  31. /* Colour declarations */
  32. #define LS_BLACK        0
  33. #define LS_BLUE         1
  34. #define LS_GREEN        2
  35. #define LS_CYAN         3
  36. #define LS_RED          4
  37. #define LS_MAGENTA      5
  38. #define LS_BROWN        6
  39. #define LS_LGREY        7    /* Australian/American spelling */
  40. #define LS_LGRAY        7
  41. #define LS_DGREY        8    /* Australian/American spelling */
  42. #define LS_DGRAY        8
  43. #define LS_LBLUE        9
  44. #define LS_LGREEN      10
  45. #define LS_LCYAN       11
  46. #define LS_LRED        12
  47. #define LS_LMAGENTA    13
  48. #define LS_YELLOW      14
  49. #define LS_WHITE       15
  50.  
  51. /* Global variables - needed in assembly modules as well */
  52. /* _NOT_ C accessable!
  53. extern unsigned int ls_mode;              Last mode set (using LSpeed)
  54. extern unsigned int ls_apage;             Currently active video page
  55. extern unsigned int ls_vpage;             Currently visible video page
  56. extern unsigned int ls_scrcols;           Current number of columns
  57. extern unsigned int ls_scrrows;           Current number of rows
  58. extern unsigned int ls_page1start;        Address of the first page
  59. extern unsigned int ls_page2start;        Address of the second page
  60. extern unsigned int ls_bytesline;         Number of bytes per line
  61. extern unsigned int ls_originoffset;      Offset from the origin
  62. extern unsigned int ls_apagestart;        Start address of the active page */
  63. /* C accessable */
  64. extern char ls_registeredfonts[];      /* Fonts active in memory */
  65. extern char ls_fontheights[];          /* Heights of the fonts */
  66.  
  67. /* Video mode values */
  68. #define EGA_320x200     0x000D;
  69. #define EGA_640x200     0x000E;
  70. #define EGA_640x350     0x0010;
  71. #define EGA_80x25       0x0003;
  72. #define EGA_40x25       0x0001;
  73.  
  74. /* Font data declarations */
  75. #define     BROAD_FONT           1
  76. extern char far *ls_broadfont;
  77. extern char ls_broadfontdata[];
  78. #define     COMPUTER_FONT        2
  79. extern char far *ls_computerfont;
  80. extern char ls_computerfontdata[];
  81. #define     PLASMA_FONT          3
  82. extern char far *ls_plasmafont;
  83. extern char ls_plasmafontdata[];
  84. #define     SMALL_FONT           4
  85. extern char far *ls_smallfont;
  86. extern char ls_smallfontdata[];
  87. #define     STANDARD_FONT        5
  88. extern char far *ls_standardfont;
  89. extern char ls_standardfontdata[];
  90. #define     TALL_FONT            6
  91. extern char far *ls_tallfont;
  92. extern char ls_tallfontdata[];
  93. #define     SCRIPT_FONT          7
  94. extern char far *ls_scriptfont;
  95. extern char ls_scriptfontdata[];
  96. #define     NICE_FONT            8
  97. extern char far *ls_nicefont;
  98. extern char ls_nicefontdata[];
  99. #define     CRISP_FONT           9
  100. extern char far *ls_crispfont;
  101. extern char ls_crispfontdata[];
  102. #define     OLD_ENGLISH_FONT    10
  103. extern char far *ls_oldenglishfont;
  104. extern char ls_oldenglishfontdata[];
  105. #define     PLAIN_FONT          11
  106. extern char far *ls_plainfont;
  107. extern char ls_plainfontdata[];
  108. #define     ITALIC_FONT         12
  109. extern char far *ls_italicfont;
  110. extern char ls_italicfontdata[];
  111.  
  112. /* Font size functions */
  113. #define     ega_fontheight(fontnum)     ls_fontheights[(fontnum)-1]
  114. #define     ega_fontwidth(fontnum)      (8)
  115.  
  116. /* Define the mouse buttons */
  117. #define   MOUSE_LEFT         1
  118. #define   MOUSE_RIGHT        2
  119. #define   MOUSE_MIDDLE       3
  120.  
  121. /* Define the known display types */
  122. #define   LS_NODISPLAY          0
  123. #define   LS_EGADISPLAY         3
  124. #define   LS_CGADISPLAY         4
  125. #define   LS_MONODISPLAY        5
  126. #define   LS_VGAMONODISPLAY     7
  127. #define   LS_VGACOLORDISPLAY    8
  128.  
  129. /* Define the primary display types */
  130. #define     LS_PRIMARY_EGA             1
  131. #define     LS_PRIMARY_CGA             2
  132. #define     LS_PRIMARY_MONOHERC        3
  133.  
  134. /* Various button macros */
  135. #define left_button()      (while (!mouse_buttons()&1)  ;)
  136. #define right_button()     (while (!mouse_buttons()&2)  ;)
  137. #define middle_button()    (while (!mouse_buttons()&3)  ;)
  138. #define wait_for_mouse()   (while (!mouse_buttons())    ;)
  139.  
  140. /* Function declarations */
  141. /* Image functions */
  142. void ega_andimage(char far *image, int xloc, int yloc);
  143. int ega_extractsize(char far *image);
  144. void ega_getimage(int topx, int topy, int bottomx, int bottomy, char far *image);
  145. int ega_imagesize(int topx, int topy, int bottomx, int bottomy);
  146. void ega_orimage(char far *image, int xloc, int yloc);
  147. void ega_putimage(char far *image, int xloc, int yloc);
  148. void ega_xorimage(char far *image, int xloc, int yloc);
  149.  
  150. /* Miscellaneous functions */
  151. void disable_screen(void);
  152. int ega_capture_area_byte(char *filename, int topx, int topy, int bottomx, int bottomy);
  153. int ega_capture_screen_byte(char *filename);
  154. int ega_restore_area_byte(char *filename, int topx, int topy, int bottomx, int bottomy, int xloc, int yloc);
  155. int ega_restore_screen_byte(char *filename);
  156. void enable_screen(void);
  157. unsigned int getxch(void);
  158. void reset_keyboard(void);
  159.  
  160. /* Mouse functions */
  161. int get_mouse_pos(int *xpos, int *ypos);
  162. int get_mouse_presses(int button, int *presses, int *lastx, int *lasty);
  163. int get_mouse_releases(int button, int *releases, int *lastx, int *lasty);
  164. int hide_mouse(void);
  165. int init_mouse(void);
  166. int mouse_buttons(void);
  167. int mouse_installed(void);
  168. int read_mouse_motions(int *xmotion, int *ymotion);
  169. int set_mouse_pos(int newx, int newy);
  170. int set_mouse_pointer(unsigned int pattern[32], int hotx, int hoty);
  171. int set_mouse_xrange(int leftlimit, int rightlimit);
  172. int set_mouse_yrange(int toplimit, int bottomlimit);
  173. void set_pointer_arrows(void);
  174. void set_pointer_cross(void);
  175. void set_pointer_crosshair(void);
  176. void set_pointer_hand(void);
  177. void set_pointer_hourglass(void);
  178. void set_pointer_pointer(void);
  179. void set_pointer_questionmark(void);
  180. void set_pointer_tick(void);
  181. void set_pointer_watch(void);
  182. int show_mouse(void);
  183.  
  184. /* Page functions */
  185. void ega_flipapage(void);
  186. void ega_flippage(void);
  187. void ega_flipvpage(void);
  188. int ega_getapage(void);
  189. int ega_getvpage(void);
  190. unsigned int ega_readorigin(void);
  191. void ega_setapage(int page);
  192. void ega_setoffset(char offset);
  193. void ega_setorigin(unsigned int origin);
  194. void ega_setvpage(int page);
  195.  
  196. /* Status functions */
  197. int display_type(void);
  198. int ega_bytesperline(void);
  199. int ega_displayheight(void);
  200. int ega_displaywidth(void);
  201. int ega_firstpageaddress(void);
  202. int ega_maxscanline(void);
  203. int ega_memory(void);
  204. unsigned char ega_readregister(int regnum);
  205. void ega_retrace(void);
  206. unsigned int ega_secondpageaddress(void);
  207. void ega_writepallete(int paldata[16]);
  208. void ega_writeregister(int regnum, unsigned char value);
  209. int find_primary(void);
  210. int get_mode(void);
  211. int second_adapter(void);
  212.  
  213. /* Text functions */
  214. int ega_broadch(int character, int xloc, int yloc, int foreground, int background);
  215. int ega_computerch(int character, int xloc, int yloc, int foreground, int background);
  216. int ega_crispch(int character, int xloc, int yloc, int foreground, int background);
  217. int ega_formattext(int xloc, int yloc, int foregrnd, int backgrnd, int font, char *format, ...);
  218. int ega_italicch(int character, int xloc, int yloc, int foreground, int background);
  219. int ega_nicech(int character, int xloc, int yloc, int foreground, int background);
  220. int ega_oldenglishch(int character, int xloc, int yloc, int foreground, int background);
  221. int ega_plainch(int character, int xloc, int yloc, int foreground, int background);
  222. int ega_plasmach(int character, int xloc, int yloc, int foreground, int background);
  223. int ega_scriptch(int character, int xloc, int yloc, int foreground, int background);
  224. int ega_smallch(int character, int xloc, int yloc, int foreground, int background);
  225. int ega_standardch(int character, int xloc, int yloc, int foreground, int background);
  226. int ega_tallch(int character, int xloc, int yloc, int foreground, int background);
  227. void ega_writechar(int character, int xloc, int yloc, int foregrnd, int backgrnd, char far *fontptr);
  228. int ega_writecharacter(int charnum, int xloc, int yloc, int foregrnd, int backgrnd, int font);
  229. void registerbroadfont(void);
  230. void registercomputerfont(void);
  231. void registercrispfont(void);
  232. void registeritalicfont(void);
  233. void registernicefont(void);
  234. void registeroldenglishfont(void);
  235. void registerplainfont(void);
  236. void registerplasmafont(void);
  237. void registerscriptfont(void);
  238. void registersmallfont(void);
  239. void registerstandardfont(void);
  240. void registertallfont(void);
  241.  
  242. /* Graphics Primitives */
  243. void ega_andcircle(int xloc, int yloc, int radius, int colour);
  244. void ega_andellipse(int xloc, int yloc, int height, int width, int colour);
  245. void ega_andline(int first, int firsty, int secondx, int secondy, int colour);
  246. void ega_andpixel(int xloc, int yloc, int colour);
  247. void ega_andpoly(int colour, ...);
  248. void ega_andrectangle(int topx, int topy, int bottomx, int bottomy, int colour);
  249. void ega_andtriangle(int firstx, int firsty, int secondx, int secondy, int thirdx, int thirdy, int colour);
  250. void ega_clearpage(void);
  251. void ega_fillarea(int xloc, int yloc, int fillcolour, int bordercolour);
  252. void ega_filledcircle(int xloc, int yloc, int radius, int colour);
  253. void ega_filledellipse(int xloc, int yloc, int height, int width, int colour);
  254. void ega_filledrectangle(int topx, int topy, int bottomx, int bottomy, int colour);
  255. void ega_andtriangle(int firstx, int firsty, int secondx, int secondy, int thirdx, int thirdy, int colour);
  256. int ega_getpixel(int xloc, int yloc);
  257. void ega_orcircle(int xloc, int yloc, int radius, int colour);
  258. void ega_orellipse(int xloc, int yloc, int height, int width, int colour);
  259. void ega_orline(int first, int firsty, int secondx, int secondy, int colour);
  260. void ega_orpixel(int xloc, int yloc, int colour);
  261. void ega_orpoly(int colour, ...);
  262. void ega_orrectangle(int topx, int topy, int bottomx, int bottomy, int colour);
  263. void ega_ortriangle(int firstx, int firsty, int secondx, int secondy, int thirdx, int thirdy, int colour);
  264. void ega_putcircle(int xloc, int yloc, int radius, int colour);
  265. void ega_putellipse(int xloc, int yloc, int height, int width, int colour);
  266. void ega_putline(int first, int firsty, int secondx, int secondy, int colour);
  267. void ega_putpixel(int xloc, int yloc, int colour);
  268. void ega_putpoly(int colour, ...);
  269. void ega_putrectangle(int topx, int topy, int bottomx, int bottomy, int colour);
  270. void ega_puttriangle(int firstx, int firsty, int secondx, int secondy, int thirdx, int thirdy, int colour);
  271. void ega_scanlinefill(int start, int end, int scanline, int colour);
  272. void ega_xorcircle(int xloc, int yloc, int radius, int colour);
  273. void ega_xorellipse(int xloc, int yloc, int height, int width, int colour);
  274. void ega_xorline(int first, int firsty, int secondx, int secondy, int colour);
  275. void ega_xorpixel(int xloc, int yloc, int colour);
  276. void ega_xorpoly(int colour, ...);
  277. void ega_xorrectangle(int topx, int topy, int bottomx, int bottomy, int colour);
  278. void ega_xortriangle(int firstx, int firsty, int secondx, int secondy, int thirdx, int thirdy, int colour);
  279. void set320x200(void);
  280. void set40x25(void);
  281. void set640x200(void);
  282. void set640x350(void);
  283. void set80x25(void);
  284.  
  285. #endif
  286.